package LC.nums.remove;

public class LC844 {
    public static void main(String[] args) {
        String s = "ab#c";
        String t = "ad#c";
        System.out.println(refactor(s).equals(refactor(t)));
        System.out.println(backspaceCompare(s, t));
    }

    /**
     * @param str
     * @return
     */
    public static String refactor(String str) {
        StringBuilder stringBuilder = new StringBuilder();
        for (int i = 0; i < str.length(); ++i) {
            char charat = str.charAt(i);
            if (charat != '#') {
                stringBuilder.append(charat);
            } else {
                if (stringBuilder.length() > 0) {
                    stringBuilder.deleteCharAt(stringBuilder.length() - 1);
                }
            }
        }
        return stringBuilder.toString();
    }

    public static boolean backspaceCompare(String s, String t) {
        return true;
    }
}
